import 'package:xin_nuo_pda/bean/eqp_info_entity.dart';
import 'package:xin_nuo_pda/bean/repair_info_entity.dart';
import 'package:xin_nuo_pda/bean/repair_list_entity.dart';
import 'package:xin_nuo_pda/http/http_client.dart';
import 'package:xin_nuo_pda/http/http_response.dart';
import 'package:xin_nuo_pda/utils/request_util.dart';
import 'package:dio/dio.dart';
import 'package:get/get.dart';

class EqpApi{

  static Future<HttpResponse<Object>> productionRepair(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<Object>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNMEREPAIR',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<EqpInfoEntity>> eqpQuery(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<EqpInfoEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'MES.EQPQUERY',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<RepairListEntity>> getRepairList(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<RepairListEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNREPAIRLIST',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<RepairInfoEntity>> getRepairInfo(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<RepairInfoEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNREPAIRDETAIL',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }

  static Future<HttpResponse<RepairInfoEntity>> repairHandler(CancelToken? cancelToken,{Map<String,dynamic>? params}) async {
    var response = await Get.find<HttpClient>().post<RepairInfoEntity>(
        'esbrest/RestService/postrequest',
        data: RequestUtil.formatJsonDataParameters(funcName:'XN.XNEEREPAIR',parame: params),
        cancelToken: cancelToken
    );
    return response;
  }
}